package com.zkw.group.service;

import com.zkw.group.entity.Course;
import com.zkw.group.entity.CourseBook;
import com.zkw.group.entity.CoursePage;
import com.zkw.group.entity.CourseRelation;
import com.zkw.group.mapper.PublicCourseMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PublicCourseService {

    @Autowired
    private PublicCourseMapper publicCourseMapper;

    //查询已发布的课程基本信息
    public List<Course> getAllPublicCourseList(String courseid,int pageStart, int pageSize){
        return publicCourseMapper.getAllPublicCourseList(courseid,pageStart,pageSize);
    }

    public int getPublicCourseCounts(String courseid){
        return publicCourseMapper.getPublicCourseCounts(courseid);
    }



    //查询指定课程的详细信息
    public Course getCourseDetail(String courseid){
        return publicCourseMapper.getCourseDetail(courseid);
    }



    //通过课程id分页查询课程章节信息
    public List<CoursePage> getAllPublicCoursePageList(String ord,String courseid,int pageStart, int pageSize){
        return publicCourseMapper.getAllPublicCoursePageList(ord,courseid,pageStart,pageSize);
    }

    public int getPublicCoursePageCounts(String ord,String courseid){
        return publicCourseMapper.getPublicCoursePageCounts(ord,courseid);
    }


    //分页获取课程先修后修关系列表
    public List<CourseRelation> getAllCourseRelationList(String relacname, String courseid, int pageStart, int pageSize){
        return publicCourseMapper.getAllCourseRelationList(relacname,courseid,pageStart,pageSize);
    }

    //获取课程先修后修关系条目数
    public int getCourseRelationCounts(String relacname,String courseid){
        return  publicCourseMapper.getCourseRelationCounts(relacname,courseid);
    }


    //分页获取课程有关参考书目列表
    public List<CourseBook> getAllCourseBookList(String bookname, String courseid, int pageStart, int pageSize){
        return publicCourseMapper.getAllCourseBookList(bookname,courseid,pageStart,pageSize);
    }

    //获取课程有关参考书目条目数
    public int getCourseBookCounts(String bookname,String courseid){
        return  publicCourseMapper.getCourseBookCounts(bookname,courseid);
    }
}
